﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HWR_Ants.Classes
{
    public class UpdateEventArgs
    {
        private int _CurrentIteration;
        private int _SuccessfulIterations;
        private int _Failures;

        private double _LastValue;
        private double _CurrentBestValue;
        private double _CurrentIterationBestValue;
        private double _DS_Global;

        private TimeSpan _timeUsed;

        private string _filename;

        private IEnumerable<City> _BestTour;

        public UpdateEventArgs(
            int current_Iteration,
            int successful_Iterations,
            int failures,
            double current_best_value,
            double current_iteration_best_value,
            double last_value,
            IEnumerable<City> bestTour)
        {
            _BestTour = bestTour;
            _CurrentBestValue = current_best_value;
            _CurrentIteration = current_Iteration;
            _Failures = failures;
            _LastValue = last_value;
            _SuccessfulIterations = successful_Iterations;
            _timeUsed = new TimeSpan();
            _CurrentIterationBestValue = current_iteration_best_value;
            _DS_Global = 0;
            _filename = String.Empty;
        }

        public int CurrentIteration
        {
            get { return _CurrentIteration; }
        }

        public int SuccessfulIterations
        {
            get { return _SuccessfulIterations; }
        }

        public int Failures
        {
            get { return _Failures; }
        }

        public double CurrentBestValue
        {
            get { return _CurrentBestValue; }
        }

        public double LastValue
        {
            get { return _LastValue; }
        }

        public IEnumerable<City> BestTour
        {
            get { return _BestTour; }
        }

        public double CurrentIterationBestValue
        {
            get { return _CurrentIterationBestValue; }
            set { _CurrentIterationBestValue = value; }
        }

        public double DS_Global
        {
            get { return _DS_Global; }
            set { _DS_Global = value; }
        }

        public TimeSpan TimeUsed
        {
            get { return _timeUsed; }
            set { _timeUsed = value; }
        }

        public string Filename
        {
            get { return _filename; }
            set { _filename = value; }
        }

        public override string ToString()
        {
            return String.Format("Iteration: {1}{0}w/o change: {2}{0}failed: {3}{0}value: {4:f1}{0}last: {5:f1}",
             "\t", CurrentIteration, SuccessfulIterations, Failures, CurrentBestValue, LastValue);

        }
    }
}
